package com.itcast.googleplay.protocol;

import java.util.List;

import com.google.gson.Gson;
import com.google.gson.reflect.TypeToken;
import com.itcast.googleplay.domain.Category;

/*
 * [
    {
        "infos": [
            {
                "name1": "休闲",
                "name2": "棋牌",
                "name3": "益智",
                "url1": "image/category_game_0.jpg",
                "url2": "image/category_game_1.jpg",
                "url3": "image/category_game_2.jpg"
            },
            {
                "name1": "射击",
                "name2": "体育",
                "name3": "儿童",
                "url1": "image/category_game_3.jpg",
                "url2": "image/category_game_4.jpg",
                "url3": "image/category_game_5.jpg"
            }
        ],
        "title": "游戏"
    },
    {
        "infos": [
            {
                "name1": "浏览器",
                "name2": "输入法",
                "name3": "健康",
                "url1": "image/category_app_0.jpg",
                "url2": "image/category_app_1.jpg",
                "url3": "image/category_app_2.jpg"
            },
            {
                "name1": "效率",
                "name2": "教育",
                "name3": "理财",
                "url1": "image/category_app_3.jpg",
                "url2": "image/category_app_4.jpg",
                "url3": "image/category_app_5.jpg"
            }
        ],
        "title": "应用"
    }
    .....
]
 */

public class CategoryProtocol extends BaseProtocol<List<Category>>{

	@Override
	public List<Category> processData(String json) {
		Gson gson = new Gson();
		return gson.fromJson(json, new TypeToken<List<Category>>(){}.getType());
	}

}
